﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataTest
{
    class StationEnroll
    {
        public static void Upload()
        {
            List<Model> lists = new List<Model>();
            using (StreamReader reader = new StreamReader("C:\\station.txt",Encoding.UTF8))
            {
                string Line;
                while (!string.IsNullOrEmpty((Line = reader.ReadLine())))
                {
                    Line = Line.Trim();
                    string[] a = Line.Split(new string[]{ " ","\t" }, StringSplitOptions.RemoveEmptyEntries);
                    lists.Add(new Model() { parent = a[0], district = a[1], name = a[2], code = a[3], addr = a[4], latitude = a[5].Substring(0, 3) + "." + a[5].Substring(3, 2), longitude = a[6].Substring(0, 2) + "." + a[6].Substring(2, 2) , height= a[7]});
                }
            }
            System.Web.Script.Serialization.JavaScriptSerializer Ser = new System.Web.Script.Serialization.JavaScriptSerializer();
            StringBuilder sb = new StringBuilder();
            Ser.Serialize(lists, sb);
            WeChatDataSrc.HttpPost.SendData("http://newqxtweixin.team4.us/data/station_enroll/", "data=" + sb.ToString());
        }
    }
    public class Model
    {
        public Model()
        {
            code = ""; name = ""; district = ""; latitude = ""; longitude = ""; parent = ""; addr = ""; height = "";
        }
        public string code { get; set; }
        public string name { get; set; }
        public string district { get; set; }
        public string latitude { get; set; }
        public string longitude { get; set; }
        public string parent { get; set; }
        public string addr { get; set; }
        public string height { get; set; }
    }
}
